using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class Chat : MonoBehaviour
{
    PointerEventData eventData;
     public Transform wanPos;
    Sprite curSprite;

    public GameObject imageSprict;


   public List<Image> list = new List<Image>();
    // Start is called before the first frame update
    private DragHandle DragHandle;
    void Start()
    {
        //    Debug.Log(wanPos.transform.position);
        //    Debug.Log("11"+wanDir.transform.position);
        DragHandle = GetComponent<DragHandle>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision != null) 
        {
            Debug.Log(collision.gameObject.name);
            GameObject curObj = collision.gameObject;
           // curObj.transform.position = wanPos.position;
            curSprite = curObj.GetComponent<Image>().sprite;
            imageSprict.SetActive(true);
            imageSprict.GetComponent<Image>().sprite =  curSprite;

            //for(int i = 0; i < list.Count; i++)
            //{
            //    if(curSprite == list[i])
            //    {
            //        list[i].gameObject.SetActive(true);
            //    }
            //}
            


        }
    }


}
